Create API to gather curve params from an OpenSSL::PKey::EC::Group#432
Open
rickmark wants to merge 3 commits intoruby:masterfrom
Open
Create API to gather curve params from an OpenSSL::PKey::EC::Group#432rickmark wants to merge 3 commits intoruby:masterfrom
OpenSSL::PKey::EC::Group#432rickmark wants to merge 3 commits intoruby:masterfrom
Conversation
added 2 commits
March 30, 2021 16:21
To allow more detailed testing seperating these tests to align with the class hierarchy
This allows for gathering the field (needed for modulus match for the curve) and other curve parameters that could be set on a new group but not read.
ioquatix
reviewed
Mar 31, 2021
rhenium
reviewed
Mar 31, 2021
Member
rhenium
left a comment
There was a problem hiding this comment.
I've also added a comment about the design at #425 (comment).
Document the fallback of `field_type` Proper newlines Split declare initialize for C conformance Remove unneeded returns for `rb_raise`
rhenium
requested changes
Apr 15, 2021
| * See the OpenSSL documentation for EC_METHOD_get_field_type(). | ||
| * If the field type is GFp (NID_X9_62_prime_field) it will return :GFp | ||
| * If the field type is GF2m (NID_X9_62_characteristic_two_field) it will return :GF2m | ||
| * If OpenSSL returns any other value it will return the raw NID_X9_62 value |
Member
There was a problem hiding this comment.
As I commented in #425, I'd like to avoid the usage of :GFp or :GF2m symbols and simply use OBJ_nid2sn().
| # frozen_string_literal: true | ||
| require_relative 'utils' | ||
|
|
||
| if defined?(OpenSSL) && defined?(OpenSSL::PKey::EC) |
Member
There was a problem hiding this comment.
I know this came from test_pkey_ec.rb, but this is redundant. While you are at it, can you update it (and other occurrences in test_pkey_ec*.rb) to simply
Suggested change
| if defined?(OpenSSL) && defined?(OpenSSL::PKey::EC) | |
| if defined?(OpenSSL::PKey::EC) |
| } | ||
|
|
||
| const EC_METHOD *method = EC_GROUP_method_of(group); | ||
| int field_type_id = EC_METHOD_get_field_type(method); |
Member
There was a problem hiding this comment.
Variable declarations need to be at the beginning of the block while we support Ruby <= 2.6.
|
|
||
| /* | ||
| * call-seq: | ||
| * group.curve_params => Array |
| BIGNUM *pBN, *aBN, *bBN; | ||
|
|
||
| GetECGroup(self, group); | ||
| if (!group) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a basic read API for getting the EC params for a given explicit or named group instance.
Resolves #425